package com.foreknow.service.impl;

import com.foreknow.dao.ConstantitemMapper;
import com.foreknow.entity.Constantitem;
import com.foreknow.service.ConstantitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConstantitemServiceImpl implements ConstantitemService {
    @Autowired
    private ConstantitemMapper constantitemMapper;

    @Override
    public int insertConstantitem(Constantitem constantitem) {
        return constantitemMapper.insert(constantitem);
    }

    @Override
    public int deleteConstantitemById(Integer id) {
        return constantitemMapper.deleteConstantItem(id);
    }

    @Override
    public Constantitem searchConstantitemById(Integer id) {
        return constantitemMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateConstantitemByObject(Constantitem constantitem) {
        return constantitemMapper.updateByPrimaryKey(constantitem);
    }

    @Override
    public List<Constantitem> searchAllConstantitem(String query) {
        return constantitemMapper.queryConstantItem(query);
    }

    @Override
    public List<Constantitem> searchAllConstantTypeItem(Integer id) {
        return constantitemMapper.queryConstantTypeItem(id);
    }
}
